<?php session_start(); ?>
<!DOCTYPE HTML>
<html>
	<div class="container">
<head>
	<title>Stewie's Market</title>
	<link rel="stylesheet" href="cs2102.css">
</head>

<body>

	<!-- Site navigation menu -->
	<?php include 'nav.php'; 

	function init_db()
	{
		// Open database connection
		$dbHost = "sid3.comp.nus.edu.sg";
		$dbHostPort="1521";
		$dbServiceName = "sid3.comp.nus.edu.sg";
		$usr = "A0103863";
		$pswd = "cs2102std";
		$dbConnStr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=".$dbHost.")(PORT=".$dbHostPort."))(CONNECT_DATA=(SERVICE_NAME=".$dbServiceName.")))";
		$dbConn = oci_connect($usr,$pswd,$dbConnStr);

		if(!$dbConn)
		{
			$err = oci_error();
			print('Could not establish a database connection: ' . $err['message']);
		}
		return $dbConn;
	}
	//print "<p><a href='search.php'>Go back</a></p>";
	print "<br><FORM><INPUT Type='button' VALUE='Back' onClick='history.go(-1);return true;'></FORM>";
	$title = $_GET['title'];
	$category = $_GET['category'];
	$condition = $_GET['condition'];
	$description = $_GET['description'];
	$price = $_GET['price'];
	$years_of_use = $_GET['years_of_use'];
	$student = $_GET['student'];
	$date = $_GET['date'];
	$matric = $_GET['matric'];

	print "<h1>".$title."</h1>";
	print "<p>".$description."</p>";
	print "<b>Category: </b>".$category."<br>";
	print "<b>Condition: </b>".$condition."<br>";
	if ($price != null && $price != "")
		print "<b>Price (SGD): </b>".$price."<br>";
	if ($years_of_use != null && $years_of_use != "")
		print "<b>Years of use: </b>".$years_of_use."<br>";

	print "<p><b>Original poster: </b>".$student."<br>";
	print "<b>Date posted: </b>".$date."<br></p>";
   
 	
  ?>
  <!-- passing the sender and receiver variable-->
 <form action="message.php" method="get">  <!-- should I have a name for this form-->
     <input type="hidden" name="matric" value=<?php echo $matric;?>>
     <input type="hidden" name="receiver" value=<?php echo $student; ?>> <!-- student is the one posting the ads and I would like to send a message to the student-->
  <!--    <input type="hidden" name="subject" value=""> -->
      
     <input type="submit" value="Send a new message">
 </form>

	<!-- Sign and date the page, it's only polite! -->
	<address>Made by Project group 31 for CS2102, NUS 2013.</address>
</div>

</body>
</div>
</html>